<?php

App::uses('AppController', 'Controller');
App::uses('CakeEmail', 'Network/Email');

class ContatosController extends AppController {
    public $name = 'Contatos';

    public function email() {
        $email = new CakeEmail();
        $email->config('gmail');
        $email->to('thiagorthomaz@gmail.com');
        $email->from(array($this->request->data['email'] => $this->request->data['nome']));
        $email->sender(array($this->request->data['email'] => $this->request->data['nome']));
        $email->subject($this->request->data['assunto']);
        $email->send($this->request->data['email'] . "<" . $this->request->data['nome'] . "> Diz: ". 
                      $this->request->data['mensagem']
                    );
        $this->redirect('/p/home');
    }

}

?>